%%
[Data,options,apps,students,enrollment]=setup_data([2010,2011,2012],Options,Students,Apps,Enrollment);

%%
%export "students" info for table-making in Julia
writetable( students(students.proceso==2010,1:37), [pathData '/students_julia_2010.csv'],'Delimiter',',');
writetable( students(students.proceso==2011,1:37), [pathData '/students_julia_2011.csv'],'Delimiter',',');
writetable( students(students.proceso==2012,1:37), [pathData '/students_julia_2012.csv'],'Delimiter',',');

writetable( options, [pathData '/options_julia_2010-12.csv'],'Delimiter',',')

%save([pathData '/SetupData_' dateDataImport '.mat'],'Data','options','students','apps','enrollment','-v7.3')
%load([pathData '/SetupData_' dateDataImport '.mat'],'Data','options','students','apps','enrollment')

%% construct "ever BVP"
inst = sort(unique(Data.TypeIndex(:,4)));
Data.EverBVP = zeros(size(inst));
for j = 1:numel(inst)
    inds_j = Data.BVPj(Data.TypeIndex(:,4) == inst(j));
    Data.EverBVP(j) = max(inds_j);
end

%%
options2010 = options(options.proceso==2010,:);
Data2010 = cutDataToSingleYear(Data,2010);
Data2010.year = 2010;
MCMC2010 = mcmcsetup(Data2010,options2010);
save([pathData '/export_to_julia_2010.mat'],'MCMC2010','-v7.3');

%%
options2011 = options(options.proceso==2011,:);
Data2011 = cutDataToSingleYear(Data,2011);
Data2011.year = 2011;
MCMC2011 = mcmcsetup(Data2011,options2011);
save([pathData '/export_to_julia_2011.mat'],'MCMC2011','-v7.3');

%%
options2012 = options(options.proceso==2012,:);
Data2012 = cutDataToSingleYear(Data,2012);
Data2012.year = 2012;
MCMC2012 = mcmcsetup(Data2012,options2012);
save([pathData '/export_to_julia_2012.mat'],'MCMC2012','-v7.3');
